public class Abs {
    public static void main(String[] args) {
        int a=123;
        float b=-123f;
        double c=-123.456;
        System.out.println("变量a："+a+"  "+"绝对值："+absluteValue(a));
        System.out.println("变量b："+b+"  "+"绝对值："+absluteValue(b));
        System.out.println("变量c："+c+"  "+"绝对值："+absluteValue(c));
    }
    public static int absluteValue(int num) {
        int absNum=num<0?-num:num;//三目运算符
        return absNum;
    }
    public static float absluteValue(float num) {
        float absNum=num<0?-num:num;
        return absNum;
    }
    public static double absluteValue(double num) {
        double absNum=num<0?-num:num;
        return absNum;
    }
}
